<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateParamsTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 参数类型表
        Schema::create('param_types', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('分组名称');
            $table->unsignedInteger('count')->default(0)->comment('包含的参数数');
            $table->timestamps();
        });

        Schema::create('param_values', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->comment('参数名称');
            $table->unsignedBigInteger('type_id')->comment('所属分组');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('param_values');
        Schema::dropIfExists('param_types');
    }
}
